<template>
	<view class="list-container">
		<text>{{pageData.tag}}</text>
		<view class="item-content">
			<homeMovieScorll :movieItem='item' v-for="item in moviesArr" :key='item._id' />
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				pageData: {
					pageSize: "18",
					currentPage: "1"
				},
				moviesArr: []
			}
		},
		methods: {
			getMovies() {
				this.$api.movies.getMovies(this.pageData).then(({
					result
				}) => {
					this.moviesArr = [...this.moviesArr, ...result];
					// console.log(result);
				})
			}
		},
		onLoad(options) {
			this.pageData.tag = options.tag;
			// console.log(options);
			this.getMovies();
		},
		onReachBottom() {
			this.pageData.currentPage++;
			this.getMovies();

		}
	}
</script>

<style scoped lang="scss">
	.list-container {
		padding: 20rpx;
        text{
			font-weight: bold;
		}
		.item-content {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-evenly;

		}
	}
</style>
